# Copyright (c) 2021 HPMicro
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required(VERSION 3.13)

set(CONFIG_CHERRYUSB 1)
set(CONFIG_USB_DEVICE 1)
set(CONFIG_USB_DEVICE_MSC 1)

find_package(hpm-sdk REQUIRED HINTS $ENV{HPM_SDK_BASE})
project(hpm_firmware_loader)

# set(CUSTOM_SES_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/ram.icf)
sdk_compile_definitions(-DCONFIG_NOT_ENABLE_DCACHE=1)
sdk_compile_definitions(-DCONFIG_NOT_ENABLE_ICACHE=1)

sdk_compile_definitions(-DHPM6750=1)

sdk_inc(msc)
sdk_inc(dm)
sdk_inc(dm/flash)

sdk_app_src(msc/main.c)
sdk_app_src(msc/bootuf2.c)
sdk_app_src(msc/msc_bootuf2.c)

sdk_app_src(dm/jtag.c)
sdk_app_src(dm/target.c)
sdk_app_src(dm/riscv_debug.c)
sdk_app_src(dm/flash/algo.c)
sdk_app_src(dm/flash/flash.c)
generate_ide_projects()
